<template>
<!--  <iframe :src="'/dev-api/static-plugin/scada-plugin/byzt/index_edit.html?stageId='+stageId+'&token=' +token" class="editIframeZT"></iframe>-->
      <iframe :src="'/dev-api/static-plugin/scada-plugin/byzt/index_edit.html?stageId='+stageId+'&token=' +token" class="editIframeZT"></iframe>
</template>
<script setup>
  import { getToken } from '@/utils/auth'

  const getCookie = (name)=>{
    const cookieValue = document.cookie
        .split('; ')
        .find(row => row.startsWith(name + '='))
        ?.split('=')[1]
      return cookieValue ? decodeURIComponent(cookieValue) : null
  }
  const getParameterFromUrl = (url, parameterName)=>{
           // 解析URL
    let parsedUrl = new URL(url)
    // 获取哈希部分
    let hash = parsedUrl.hash
    // 使用正则表达式匹配参数
    let regex = new RegExp(parameterName + '=([^&]*)')
    let match = regex.exec(hash)
    // 返回参数值或null
    return match ? match[1] : null
  }

const token = ref(getToken())
const stageId = ref(getParameterFromUrl(window.location.href,'stageId'))
</script>
<style>
.editIframeZT{
  width: 100%;
  height: 800px;
}
</style>
